package com.leyou.item.api;

import com.leyou.common.pojo.PageResult;
import com.leyou.item.bo.SpuBo;
import com.leyou.item.pojo.Brand;
import com.leyou.item.pojo.Sku;
import com.leyou.item.pojo.Spu;
import com.leyou.item.pojo.SpuDetail;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * @author shkstart
 * @create 2020-04-22 13:36
 */

public interface GoodsApi {

    @GetMapping("spu/page")
    public PageResult<SpuBo> getSpu(
            @RequestParam(value = "key",required = false) String key,
            @RequestParam(value = "saleable",required = false) Boolean saleable,
            @RequestParam(value = "page",defaultValue = "1")Integer page,
            @RequestParam(value = "rows",defaultValue = "5")Integer rows
    );

    @GetMapping("spu/detail/{id}")
    public SpuDetail getSpuDetail(@PathVariable("id") Long id);

    @GetMapping("sku/list")
    public List<Sku> getListSku(@RequestParam("id") Long id);

    //根据spuID查找spu对象
    @GetMapping("spu/{id}")
    public Spu getSpuById(@PathVariable("id") Long id);

    //根据skuId查询sku
    @PostMapping("sku/{id}")
    public Sku getSkuById(@PathVariable("id")Long id);

}
